#pragma once
//============================================================================
// Copyright (C) 2013 Brett R. Jones
//
// Issued to public domain 2013
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================
#include <string>
#include "VxDefs.h"

#pragma pack(push) 
#pragma pack(1)
class VxIPv4Address
{
public:
	//=== vars ===//
	U32 m_u32IPv4Addr;

	VxIPv4Address();

	VxIPv4Address( const char * pIpAddress );
	VxIPv4Address( U32 u32IpAddr );

	VxIPv4Address& operator=(const VxIPv4Address& oAddr);
	bool operator != (const VxIPv4Address& oAddr);
	bool operator == (const VxIPv4Address& oAddr);


	//=== methods ===//
	bool			isValid( void );
	void			setToInvalid( void );
	bool			isLoopBack( void );

	void			setIp( const char * pIpAddress );
	// note.. u32IPv4Addr must be in host order
	void			setIp( U32 u32IPv4Addr );

	void			toStdString( std::string& retIpAddress );
	std::string		toStdString( void );

	// get ip in host order
	U32				getIPv4Address( void );

private:
	void			fromString( const char * pIpAddress );
};

#pragma pack(pop)